
/*========================================================================================
 *                                                                                      *
 *               Copyright(c) 2013-2014, Cha SangWoo, All rights reserved.              *
 *                                                                                      *
 * This file is part of ChaOS.                                                          *
 *                                                                                      *
 * Permission to use, copy, modify, and distribute this software in source and binary   *
 * forms and its documentation for any purpose and without fee is hereby granted,       *
 * provided that the above copyright notice appear in all copies and that both that     *
 * copyright notice and this permission notice appear in supporting documentation.      *
 *                                                                                      *
 * THIS SOFTWARE IS PROVIDED BY THE CHA SANGWOO AND CONTRIBUTORS "AS IS" AND ANY        *
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED            *
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.   *
 * IN NO EVENT SHALL CHA SANGWOO OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,    *
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT         *
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,          *
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF            *
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE      *
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,                    *
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                                   *
 *                                                                                      *
========================================================================================*/

#ifndef __CO_THREAD_H__
#define __CO_THREAD_H__

//#include "co_port.h"
#include "co_types.h"

#ifdef __cplusplus
    extern "C" {
    namespace ChaOS {
#endif

//////////////////////////////////////  < BEGIN >  ///////////////////////////////////////

/*======================================================================================*/
/*
    @fn             OBJECT co_thread_create(UINT            stack_size,
                                            THREAD_PROC     entry_point,
                                            UINT            argument)

    @brief          Create a thread.

    @param [in]     object - The size of new thread's stack
    @param [in]     pname - The priority of new thread
    @param [in]     pname - argument for new thread

    @return         Object for thread.
*/
/*======================================================================================*/
OBJECT co_thread_create(UINT            stack_size,     // size of stack
                        THREAD_PROC     entry_point,    // entry point for new thread
                        UINT            argument);      // argument for new thread


/*======================================================================================*/
/*
    @fn             VOID co_thread_set_name(OBJECT object, CHAR *pname)

    @brief          

    @param [in]     object - 
    @param [in]     pname - 

    @return         None.
*/
/*======================================================================================*/
#if (FLAG_USE_THREAD_NAME == CO_ENABLE)
    VOID    co_thread_set_name(OBJECT object, CHAR *pname);

#else
    #define co_thread_set_name(object, pname)       DO_NOTHING

#endif


/*======================================================================================*/
/*
    @fn             VOID co_thread_sleep(UINT16 milisecond)

    @brief          

    @param [in]     milisecond - 

    @return         None.
*/
/*======================================================================================*/
VOID co_thread_sleep(UINT16 milisecond);


//////////////////////////////////////  <  END  >  ///////////////////////////////////////

#ifdef __cplusplus
    } /* namespace ChaOS */
    } /* extern "C" */
#endif

#endif //__CO_INITIAL_H__

